package zh;

public class Utils
{
    private Utils(){}
    
    public static double normalRelativeAngle(double angle)
    {
        if (angle > -180 && angle <= 180)
        {
            return angle;
        }
        double fixedAngle = angle;
        
        while (fixedAngle <= -180)
        {
            fixedAngle += 360;
        }
        while (fixedAngle > 180)
        {
            fixedAngle -= 360;
        }
        return fixedAngle;
    }
    
    public static double sign(double value)
    {
        if (value == 0.0)
        {
            return 1.0;
        }
        else
        {
            return (value / Math.abs(value));
        }
    }

}
